// Google Chrome Game Tools
// Copyright (c) 2010 Joseph Huckaby

Class.create( 'Plane', {
	
	sprites: null,
	
	init: function() {
		this.sprites = {};
	},
	
	destroy: function() {
		this.sprites = {};
	},
	
	addSprite: function(sprite) {
		sprite.plane = this;
		sprite.init();
		this.sprites[ sprite.id ] = sprite;
	},
	
	get: function(id) {
		return this.sprites[id];
	},
	
	logic: function() {
		// logic loop
		for (var id in this.sprites) {
			if (this.sprites[id] && this.sprites[id].logic) this.sprites[id].logic();
		}
	},
	
	draw: function() {
		// draw loop
		for (var id in this.sprites) {
			if (this.sprites[id] && this.sprites[id].draw) this.sprites[id].draw();
		}
	}
	
} );
